package cn.gjculture.shopping.api.entity;

import cn.gjculture.shopping.api.util.UUIDUtil;
import lombok.Data;

@Data
public class Token {
    private String customerId;
    private User user;
    private String tokenId;
    private String privateKey;
    private long expirationTime;


    public Token(){}

    public boolean isNoLate(){
        if (this.expirationTime>=System.currentTimeMillis()) {
            return true;
        }
        return false;
    }

    public Token(boolean init){
        if(init){
            this.tokenId=UUIDUtil.getUUID();
            this.privateKey=UUIDUtil.getPrivateKey();
        }
    }

}
